package mount

import (
	"log"
	"runtime"
)

var DO DiskOperator

func InitDO(username, password string) {
	switch runtime.GOOS {
	case "windows":
		DO = NewWindowsDisk(username, password)
	case "linux":
		DO = NewLinuxDisk(username, password)
	default:
		log.Fatal("unsupported operating system")
	}
}

// FSMount 挂载网络共享文件系统到指定的本地路径
func FSMount(fsPath, username, passwd string) (err error) {
	return DO.FSMount(fsPath, username, passwd)
}

// UnMountFS 卸载网络共享文件系统
func UnMountFS(fsPath, clientIp string) (err error) {
	return DO.UnMountFS(fsPath, clientIp)
}

// CheckMountHealth 判断挂载点是否正常
func CheckMountHealth(fsPath, clientIp string) (err error) {
	return DO.CheckMountHealth(fsPath, clientIp)
}

// IsMounted 根据MountSliceIns查询本地的windows主机有没有相应的挂载点
func IsMounted(fsPath string) (mounted bool, err error) {
	return DO.IsMounted(fsPath)
}

func ListMount() (bytes []byte, err error) {
	return DO.ListMount()
}
